package com.mcflies.commons;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.mcflies.ui.R;

/**
 * @author:mcfly_jun
 * @create_date:2012-8-10
 * @comment:/src/com/mcflies/ui/menu/ImitateUCMenuActivity.java中ListView自定义适配器
 */
public class ImitateUCMenuMainLVAdapter extends BaseAdapter {
	private Context context;
	private String[] imitateUCMenuMainLVArray;
	private LayoutInflater layoutInflater;

	public ImitateUCMenuMainLVAdapter() {
	}

	public ImitateUCMenuMainLVAdapter(Context context,
			String[] imitateUCMenuMainLVArray) {
		this.context = context;
		this.imitateUCMenuMainLVArray = imitateUCMenuMainLVArray;
		layoutInflater = LayoutInflater.from(this.context);
	}

	@Override
	public int getCount() {
		return imitateUCMenuMainLVArray.length;
	}

	@Override
	public Object getItem(int position) {
		return null;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View view, ViewGroup viewgroup) {
		if (null == view) {
			view = layoutInflater.inflate(
					R.layout.imitate_uc_menu_main_listview_item, null);
		}
		ImageView imitateUCmenuListViewItem_LeftIV = (ImageView) view
				.findViewById(R.id.imitateUCMenuListViewItem_LeftIV);
		TextView imitateUCMenuListViewItem_TV = (TextView) view
				.findViewById(R.id.imitateUCMenuListViewItem_TV);
		ImageView imitateUCMenuListViewItem_RightIV = (ImageView) view
				.findViewById(R.id.imitateUCMenuListViewItem_RightIV);
		imitateUCmenuListViewItem_LeftIV
				.setImageResource(R.drawable.imitate_uc_menu_listview_item_left_image);
		imitateUCMenuListViewItem_TV
				.setText(imitateUCMenuMainLVArray[position]);
		
		imitateUCMenuListViewItem_RightIV
				.setImageResource(R.drawable.imitate_uc_menu_listview_item_right_image);
		return view;
	}
}
